{% extends 'base.html' %}
{% block content %}
    <h3>qrange: <code>{{ name }}</code></h3>
    <div class="pull-left">
        <a class="btn btn-info btn-sm" href="{{ url_for('queuePush', name=name) }}">
            <span class="glyphicon glyphicon-plus"></span> Push
        </a>
        <a class="btn btn-danger btn-sm" href="{{ url_for('queuePop', name=name) }}">
            <span class="glyphicon glyphicon-minus"></span> Pop
        </a>
    </div>

    <div class="pull-right">
        <form class="form-inline" action="{{ url_for('queueRange') }}">
            <div class="form-group">
                <label for="start">Start</label>
                <input type="text" name="start" id="start" value="{{ start }}" class="form-control" placeholder="index">
                <input type="hidden" name="name" value="{{ name }}" >
                {% include 'select_size.html' %}
            </div>
            <button type="submit" class="btn btn-info btn-sm">Query</button>
        </form>
    </div>

    <div class="clear"></div>
    <table class="table table-striped table-hover">
        <thead>
        <tr class="info">
            <th>Index</th>
            <th>Item</th>
            <th>Item Length</th>
            <th>Action</th>
        </tr>
        </thead>
        <tbody>
        {% for item in item_list %}
            <tr>
                <td><a href="{{ url_for('queueGet', name=name, index=start_index + loop.index0) }}">{{ start_index + loop.index0 }}</a></td>
                <td>{{ item|safe|truncate(100, True) }}</td>
                <td>{{ item|count }}</td>
                <td><a href="{{ url_for('queueGet', name=name, index=start_index + loop.index0) }}" title="View" class="btn btn-xs btn-info"><span class="glyphicon glyphicon-eye-open"></span></a></td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
{% include 'paging_tabs.html' %}
{% endblock %}